load(
    "//tools:defaults.bzl",
    "extract_tokens",
    "markdown_to_html",
    "ng_module",
    "sass_binary",
    "sass_library",
)

package(default_visibility = ["//visibility:public"])

ng_module(
    name = "form-field",
    srcs = glob(
        ["**/*.ts"],
        exclude = ["**/*.spec.ts"],
    ),
    assets = [":form_field_scss"] + glob(["**/*.html"]),
    deps = [
        "//src:dev_mode_types",
        "//src/cdk/bidi",
        "//src/cdk/observers/private",
        "//src/cdk/platform",
        "//src/material/core",
        "@npm//@angular/forms",
        "@npm//rxjs",
    ],
)

sass_library(
    name = "form_field_scss_lib",
    srcs = [
        "_form-field-theme.scss",
    ],
    deps = [
        ":form_field_partials",
        "//src/material/core:core_scss_lib",
    ],
)

sass_binary(
    name = "form_field_scss",
    src = "form-field.scss",
    deps = [
        ":form_field_partials",
        "//src/material:sass_lib",
        "//src/material/core:core_scss_lib",
    ],
)

sass_library(
    name = "form_field_partials",
    srcs = [
        "_form-field-focus-overlay.scss",
        "_form-field-high-contrast.scss",
        "_form-field-native-select.scss",
        "_form-field-subscript.scss",
        "_mdc-text-field-density-overrides.scss",
        "_mdc-text-field-structure.scss",
        "_mdc-text-field-structure-overrides.scss",
        "_mdc-text-field-textarea-overrides.scss",
        "_user-agent-overrides.scss",
    ],
    deps = [
        "//src/cdk:sass_lib",
        "//src/material/core:core_scss_lib",
    ],
)

markdown_to_html(
    name = "overview",
    srcs = [":form-field.md"],
)

extract_tokens(
    name = "tokens",
    srcs = [":form_field_scss_lib"],
)

filegroup(
    name = "source-files",
    srcs = glob(["**/*.ts"]),
)
